﻿using Microsoft.Extensions.DependencyInjection;
using Naruto.Configuration;
using Naruto.Configuration.Core;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace Microsoft.AspNetCore.Builder
{
    public static class SubscribeExtension
    {
        /// <summary>
        /// 启用热更新的订阅服务
        /// </summary>
        /// <param name="builder"></param>
        /// <returns></returns>
        public static async Task UseCofigurationSubscribeAsync(this IApplicationBuilder builder)
        {
            await builder.ApplicationServices.GetRequiredService<ISubscribeReload>().ReloadAsync().ConfigureAwait(false);
        }
    }
}
